﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ActivePalControls.ControlsData;

namespace ActivePalInterop.Data
{
    /// <summary>
    /// Represents a human under phisical ativity monitoring
    /// </summary>
    public class Person
    {
        #region Properties

        /// <summary>
        /// Person guid id, stored in a database
        /// </summary>
        public Guid PersonId { get; set; }

        /// <summary>
        /// Gets or sets first name of the person
        /// </summary>
        public string FirstName { get; set; }

        /// <summary>
        /// Gets or sets last name of the person
        /// </summary>
        public string LastName { get; set; }

        /// <summary>
        /// Gets or sets age of the person
        /// </summary>
        public double Age { get; set; }

        /// <summary>
        /// Gets or sets gender of the person
        /// </summary>
        public Gender Gender { get; set; }

        /// <summary>
        /// Gets or sets Body Mass Index of the person
        /// </summary>
        public double BMI { get; set; }

        /// <summary>
        /// Gets or sets height in metric system of the person
        /// </summary>
        public double Height { get; set; }

        /// <summary>
        /// Gets or sets weight in metric system of the person
        /// </summary>
        public double Weight { get; set; }

        /// <summary>
        /// Gets or sets summary of deseases of the person
        /// </summary>
        public string Desease { get; set; } 

        #endregion

        /// <summary>
        /// Creates an empty object with initialized PersonId
        /// </summary>
        public Person()
        {
            PersonId = Guid.NewGuid();
        }

        /// <summary>
        /// Call database method to add a new person to DB
        /// </summary>
        /// <returns>true if person added successfully, otherwise false</returns>
        public bool Create()
        {
            bool res = DbFacade.GetInstance().CreatePerson(this);
            return res;
        }

        public bool Update()
        {
            bool res = DbFacade.GetInstance().UpdatePerson(this);
            return res;
        }

        public bool Delete()
        {
            bool res = DbFacade.GetInstance().DeletePerson(this);
            return res;
        }
    }
}
